package com.bktalk;

import android.content.Context;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.graphics.Rect;
import android.graphics.Paint.Style;
import android.util.AttributeSet;
import android.view.View;

public class TestView extends View {
	private Paint mPaint;  
    // private static final String mText = "drawText";  
    private String mText = "drawText";  
    
    public TestView(Context context, AttributeSet attrs, int defStyle) {
		super(context, attrs, defStyle);
		// TODO Auto-generated constructor stub
	}
	
    public TestView(Context context, AttributeSet attrs) {
		super(context, attrs);
		// TODO Auto-generated constructor stub
	}
    
	public TestView(Context context) {
		super(context);
		// TODO Auto-generated constructor stub
	}
	
    @Override  
    protected void onDraw(Canvas canvas) {  
        super.onDraw(canvas);  
        mPaint = new Paint();  
        mPaint.setColor(Color.BLUE);  
        // FILL填充, STROKE描边,FILL_AND_STROKE填充和描边  
        mPaint.setStyle(Style.FILL);  
        canvas.drawRect(new Rect(10, 10, 100, 100), mPaint);// 画一个矩形  
  
        mPaint.setColor(Color.GREEN);  
        mPaint.setTextSize(35.0f);  
        canvas.drawText(mText, 10, 60, mPaint);  
    }  

}
